package com.itheima.homework;

import java.util.Scanner;

public class Worker {
    private String name;
    private int year;

    public Worker() {
    }

    public Worker(String name, int year) {
        this.name = name;
        this.year = year;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getYear() {
        return year;
    }

    public void setYear(int year) {
        this.year = year;
    }
}
class Demo1{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Worker w = new Worker();
        System.out.println("请录入工人姓名：");
        String s1 = sc.next();
        w.setName(s1);
        System.out.println("请录入工人工龄");
        int s2 = sc.nextInt();
        w.setYear(s2);
        System.out.println("该工人的属性信息如下:");
        System.out.println("姓名: "+w.getName());
        System.out.println("工龄: "+w.getYear());
    }
}
